﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace OpSatPlan.Encoder
{
    public class StateEncoder
    {
        private CnfEncoder mEncoder;

        public StateEncoder(CnfEncoder encoder)
        {
            this.mEncoder = encoder;
        }

        public void Encode(List<ValuedAtomicFormula> state, int level)
        {
            foreach (ValuedAtomicFormula vaf in state)
            {
                int var = this.mEncoder.GetVariable(vaf, level);
                this.mEncoder.WriteClause((vaf.Value ? var : -var) + " 0");
            }
        }
    }
}
